Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Encoder (digital)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Encoder_(digital)"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.math.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Encoder_digital rootpage-Encoder_digital skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Encoder (digital)</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">

<p>An <b>encoder</b> (or "simple encoder") in <a href="Digital_electronics" title="Digital electronics">digital electronics</a> is a <a href="One-hot" title="One-hot">one-hot</a> to binary <a href="Code" title="Code">converter</a>. That is, if there are 2<sup><i>n</i></sup> input lines, and at most only one of them will ever be high, the binary code of this 'hot' line is produced on the <i>n</i>-bit output lines. A binary encoder is the <a href="Duality_(mathematics)" title="Duality (mathematics)">dual</a> of a <a href="Binary_decoder" title="Binary decoder">binary decoder</a>.
</p><p>If the input circuit can guarantee at most a single-active input, a simple encoder is a better choice than a <a href="Priority_encoder" title="Priority encoder">priority encoder</a>, since it requires less logic to implement. However, a simple encoder can generate an incorrect output when more than a single input is active, so a <a href="Priority_encoder" title="Priority encoder">priority encoder</a> is required in such cases.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Types_of_encoder">Types of encoder</h2></div>
<div class="mw-heading mw-heading3"><h3 id="2n-to-n_encoders">2<sup>n</sup>-to-n encoders</h3></div>
<p>A <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle 2^{n}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msup>
<mn>2</mn>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msup>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle 2^{n}}</annotation>
</semantics>
</math></span><img src="./8226f30650ee4fe4e640c6d2798127e80e9c160d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:2.381ex; height:2.343ex;" alt="{\displaystyle 2^{n}}" loading="lazy"></span>-to-n encoder has n number of outputs in correspondence to the <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle 2^{n}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<msup>
<mn>2</mn>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msup>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle 2^{n}}</annotation>
</semantics>
</math></span><img src="./8226f30650ee4fe4e640c6d2798127e80e9c160d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:2.381ex; height:2.343ex;" alt="{\displaystyle 2^{n}}" loading="lazy"></span> number of inputs. It thus reduces the number of transmission lines and can be compared to a <a href="Multiplexer" title="Multiplexer">multiplexer</a>. Only one of the inputs become "high" (logic state "1") at a time.
</p><p>For example, a 4-to-2 simple encoder takes 4 input bits and produces 2 output bits. The illustrated gate level example implements the simple encoder defined by the truth table, but it must be understood that for all the non-explicitly defined input combinations (i.e., inputs containing 0, 2, 3, or 4 high bits) the outputs are treated as <a href="Don't-care_term" title="Don't-care term">don't cares</a>.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading4"><h4 id="4-to-2_encoder">4-to-2 encoder</h4></div>

<table class="wikitable" style="margin:1em auto 1em auto; text-align:center;">
<caption>Truth Table
</caption>
<tbody><tr style="background:#def; font-weight:bold">
<td colspan="4">Input</td>
<td colspan="3" style="border-left:2px solid #000;">Output
</td></tr>
<tr style="border-bottom:2px solid #000; background:#def; font-weight:bold">
<td>I<sub>3</sub></td>
<td>I<sub>2</sub></td>
<td>I<sub>1</sub></td>
<td>I<sub>0</sub>
</td>
<td style="border-left:2px solid #000;">O<sub>1</sub></td>
<td>O<sub>0</sub>
</td></tr>
<tr>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0
</td>
<td colspan="2" style="background: #ececec; color: #2C2C2C; border-left:2px solid #000;"><a href="Don't-care_term#X_value" title="Don't-care term">x</a>
</td></tr>
<tr>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#bfd; color:black; vertical-align:middle; text-align:center;" class="table-yes2">1
</td>
<td style="background: #FFC7C7; color: black; border-left:2px solid #000;">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0
</td></tr>
<tr>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#bfd; color:black; vertical-align:middle; text-align:center;" class="table-yes2">1</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0
</td>
<td style="background: #FFC7C7; color: black; border-left:2px solid #000;">0</td>
<td style="background:#bfd; color:black; vertical-align:middle; text-align:center;" class="table-yes2">1
</td></tr>
<tr>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#bfd; color:black; vertical-align:middle; text-align:center;" class="table-yes2">1</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0
</td>
<td style="background:#bfd; color:black; border-left:2px solid #000;">1</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0
</td></tr>
<tr>
<td style="background:#bfd; color:black; vertical-align:middle; text-align:center;" class="table-yes2">1</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0</td>
<td style="background:#FFC7C7;color:black;vertical-align:middle;text-align:center;" class="table-no">0
</td>
<td style="background:#bfd; color:black; border-left:2px solid #000;">1</td>
<td style="background:#bfd; color:black; vertical-align:middle; text-align:center;" class="table-yes2">1
</td></tr></tbody></table>
<div style="clear:both;" class=""></div>
<p><a class="external free external" href="https://en.m.wikipedia.org/wiki/Encoder_(digital)#/editor/4">https://en.m.wikipedia.org/wiki/Encoder_(digital)#/editor/4</a>
<a class="external free external" href="https://en.m.wikipedia.org/wiki/Encoder_(digital)#/editor/4">https://en.m.wikipedia.org/wiki/Encoder_(digital)#/editor/4</a>
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Binary_decoder" title="Binary decoder">Binary decoder</a></li>
<li><a href="Multiplexer" title="Multiplexer">Multiplexer</a> (MUX)</li>
<li><a href="Priority_encoder" title="Priority encoder">Priority encoder</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite class="citation news cs1"><a rel="nofollow" class="external text" href="http://www.electronicshub.org/binary-encoder/">"Binary Encoders And Their Applications"</a>. <i>Electronics Hub</i>. 2015-06-29<span class="reference-accessdate">. Retrieved <span class="nowrap">2017-05-01</span></span>.</cite></span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-05-01" href="https://en.wikipedia.org/wiki/?title=Encoder_(digital)&amp;oldid=1288212683">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>